<div class="page-header">
	<ul id="table-tab" class="nav nav-tabs" role="tablist">
		<li role="presentation" class="">
			<a href="#function-tab" aria-controls="function-tab" role="tab" data-toggle="tab">功能管理</a>
		</li>
	</ul>
</div>
<div class="tab-content">
	<div id="function-tab" class="tab-pane active" role="tabpanel">
		<div class="row">
	        <!--搜索域-->
	        <div class="col-xs-12">
	        	<div class="search-area">
	        		<form id="table-function-search" class="form-inline">
	    				<div class="form-group">
	                        <label for="menu.parentid">所属菜单：</label>
	                        <x:select models="${modelSel('menu','1')}" defaultOption="请选择" field="uuid,name"
		         				id="function-menuid" name="function.menuid" class="chosen-select form-control" >
		         			</x:select>
	                    </div>
	                 	<div class="form-group">
	                    	<label for="function.name">元素名称：</label>
	                    	<input type="text" class="form-control input-sm" id="function.name" name="function.name" value="" placeholder="">
	                 	</div>
	                 	<button id="btn-function-search" type="button" class="btn btn-info btn-sm no-border">
	                 		<i class="ace-icon fa fa-search bigger-110"></i>查询
	                 	</button>
	                 	<div class="form-group pull-right">
							<span>查询方式：</span>
							<label class="radio-inline">
								<input type="radio" name="searchType" value="1" checked="checked" />精确
							</label>
							<label class="radio-inline">
								<input type="radio" name="searchType" value="0" />模糊
							</label>
						</div>
	                </form>
	            </div>
	        </div>
	    </div>
		<!-- 数据表格 -->
       <div class="row">
           <div class="col-xs-12">
           	<div id="table-function-toolbar">
           		<div class="btn-group btn-group-sm">
                    <!-- <button id="viewFunction" class="btn btn-purple btn-sm no-border" >
                        <i class="ace-icon fa  fa-eye bigger-110 "></i>查看
                    </button>
                    <button id="addFunction" class="btn btn-info btn-sm no-border" 
                    	onclick="goAdd('新增功能', 'system/admin/function/add?type=0', 'table-function');">
                        <i class="ace-icon fa fa-plus bigger-110"></i>新增
                    </button>
                    <button id="editFunction" class="btn btn-success btn-sm no-border"
                    	onclick="goUpdate('编辑功能', 'system/admin/function/edit', 'table-function');">
                        <i class="ace-icon fa fa-pencil-square-o bigger-110"></i>编辑
                    </button>
                    <button id="delFunction" class="btn btn-danger btn-sm no-border"
                    	onclick="doDels('system/admin/function/deletes', 'table-function');">
                        <i class="ace-icon fa fa-trash-o bigger-110"></i>删除
                    </button> -->
                    <x:toolbar menuId="${menuId}" elemIds="addFunction,editFunction,delFunction">
                    </x:toolbar>
                 </div>
             </div>
           	<table id="table-function" 
           			data-toolbar="#table-function-toolbar" 
           			data-sort-name="sorting" 
           			data-sort-order="asc"
           			data-show-columns="true"
           			data-id-field="uuid">
           		 <thead>
                       <tr>
                           <th data-field="state" data-checkbox="true"></th>
                           <th data-width="120" data-field="name" data-align="left" data-sortable="false">功能名称</th>
                           <th data-width="100" data-field="elem_id" data-align="left">元素ID</th>
                           <th data-width="80" data-field="elem_type" data-align="left">元素类型</th>
                           <th data-width="80" data-field="elem_icon" data-align="left" data-formatter="fmtIcon">元素图标</th>
                           <th data-width="80" data-field="act_evt" data-align="left" data-sortable="true">动作事件</th>
                           <th data-field="act_url" data-align="left" data-sortable="true">动作URL</th>
                           <th data-width="60" data-field="sorting" data-align="left" data-sortable="true">元素排序</th>
                       </tr>
                   </thead>
               </table>
           </div>
       </div>
	</div>
</div>

<script type="text/javascript">
$(function(){
	$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
		//e.target // 激活的标签页
		//e.relatedTarget // 前一个激活的标签页
		var tabId = $(e.target).attr('aria-controls');
		if(tabId == "function-tab"){
			initTableList('table-function','system/admin/function/dataGrid', 'table-function-search', 'btn-function-search');
		}
	});
	$('#table-tab a[href="#function-tab"]').tab('show');
});

function fmtIcon(value, row, index) {
	return "<i class=\""+value+"\"></i>";
}
</script>
